export function getRoomListLog (options) {
  return window.fetch({
    method: 'POST',
    url: '/roomlog/list',
    data: {
      pageNo: options.pageNo || 1,
      pageSize: options.pageSize || 10,
      startDate: options.startDate,
      targetSupplierId: options.targetSupplierId || null,
      saleHotelId: options.saleHotelId || null,
      saleRoomId: options.saleRoomId || null,
      type: options.type,
      start: options.start || null,
      end: options.end || null,
      operator: options.operator || null,
      roomType:options.roomType
    }
  })
}

export function getSaleHotelNames () {
  return window.fetch({
    method: 'POST',
    url: '/salehotel/names'
  })
}

export function getProductQuery (options) {
  return window.fetch({
    method: 'POST',
    url: '/product/query',
    data: options
  })
}

export function getSuppliersNameList (options) {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/nameList',
    data: {
      saleHotelId: options.saleHotelId || null
    }
  })
}

export function updateProduct (data) {
  return window.fetch({
    method: 'POST',
    url: '/product/update',
    data
  })
}

export function getSaleRoomAllRooms (data) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/allrooms',
    data:data
  })
}

export function getSuperior () {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/getSuperior'
  })
}

export function getChannels () {
  return window.fetch({
    method: 'POST',
    url: '/suppliers/channels'
  })
}

export function getBedList (options) {
  return window.fetch({
    method: 'POST',
    url: '/bed/list',
    data: {
      saleHotelId: options.saleHotelId || null
    }
  })
}

export function updateSalerules (data) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/salerules/update',
    data
  })
}

export function updateBase (data) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/upbases',
    data
  })
}



export function getloadItens (saleHotelId) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/loadItems',
    data: {
      id: saleHotelId
    }
  })
}

export function addSaleRoom (data) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/add',
    data:data
  })
}

export function updateSaleRoom (data) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/update',
    data
  })
}

export function updateRoomStatus (data) {
  return window.fetch({
    method: 'POST',
    url: '/roomstatus/update',
    data
  })
}

export function getMinimalList (data) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/minimalList',
    data
  })
}

export function updateRoomPrices (data) {
  return window.fetch({
    method: 'POST',
    url: '/roomPrices/update',
    data: data
  })
}

export function shareProduct (statics, sale, supplier, options) {
  return window.fetch({
    method: 'POST',
    url: '/product/share',
    data: {
      staticRoomIds: statics,
      saleRoomIds: sale,
      supplierId: supplier,
      saleHotelId: options.saleHotelId,
      pageSize: options.limitDays,
      startDate: options.startDate,
      targetSupplierId: options.supplierId
    }
  })
}

export function saleRoomToggle (status, id, options) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/online/toggle',
    data: {
      status: status,
      id: id,
      pageSize: options.limitDays,
      targetSupplierId: options.supplierId
    }
  })
}

export function deleteSaleRoom (id) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/delete',
    data: id
  })
}

export function getDateProduct (options, mode) {
  return window.$http({
    method: 'GET',
    url: '/product/getdate',
    params: {
      token: window.commo.token,
      inDate: options.startDate,
      mode: mode
    }
  })
}

export function getSaleRoom (options) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/get',
    data: {
      id: options
    }
  })
}

export function editSaleRoom (data) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/update',
    data
  })
}

export function getSaleRoomList (options) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/room/list',
    data: options
  })
}

export function addStaticRoom (room, options) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/staticroom/add',
    data: Object.assign({}, room, {
      pageSize: options.limitDays,
      startDate: options.startDate,
      targetSupplierId: options.supplierId
    })
  })
}

export function updateInventory (room, options) {
  return window.fetch({
    method: 'POST',
    url: '/inventory/update',
    data: Object.assign({}, room, {
      pageSize: options.limitDays,
      startDate: options.startDate,
      targetSupplierId: options.supplierId
    })
  })
}

export function updateBacthInventory (room, edit, options) {
  return window.fetch({
    method: 'POST',
    url: '/inventory/update',
    data: Object.assign({}, room, edit, {
      pageSize: options.limitDays,
      startDate: options.startDate,
      targetSupplierId: options.supplierId
    })
  })
}

export function getAllRooms (room, statics, options) {
  return window.fetch({
    method: 'POST',
    url: '/saleroom/allrooms',
    data: Object.assign({}, room, {
      staticRoomIds: statics.staticRoom || null,
      saleRoomIds: statics.saleRoom || null,
      saleHotelId: options.saleHotelId || null,
      supplierId: options.supplierId || null
    })
  })
}

export function showPrice () {
  return window.fetch({
    method: 'GET',
    url: '/product/purchaseprice/show',
    params: {
      token: window.commo.token
    }
  })
}

//优惠券列表
export function GetCoupon (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/coupon/list',
    data: data
  })
}
//新增编辑优惠券
export function RedactCoupon (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/coupon/redact',
    data: data
  })
}
//优惠券状态
export function StateCoupon (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/coupon/state',
    data: data
  })
}

//优惠券包列表
export function GetCouponPackage (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/bag/list',
    data: data
  })
}
//新增编辑优惠券包
export function RedactCouponPackage (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/bag/redact',
    data: data
  })
}
//优惠券包状态
export function StateCouponPackage (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/bag/state',
    data: data
  })
}
//优惠券包下拉
export function PullCouponPackage (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/bag/pull',
    data: data
  })
}
//在线购券列表
export function GetOnlinePurchase (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/list',
    data: data
  })
}
//团购券 优惠券列表
export function PullOnlinePurchase (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/pull',
    data: data
  })
}
//新增在线购券
export function RedactOnlinePurchase (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/redact',
    data: data
  })
}
//在线购券状态
export function StateOnlinePurchase (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/state',
    data: data
  })
}
//在线购券记录
export function RecordOnlinePurchase (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/record',
    data: data
  })
}

//在线购券活动详情
export function ActivityOnlinePurchase (data) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/activity',
    data: data
  })
}

//  团购券订单详情
export function Orderinfo (id) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/orderinfo',
    data: id
  })
}

//  生成海报
export function poster (id) {
  return window.fetch({
    method: 'POST',
    url: '/marketing/buy/poster',
    data: id
  })
}



